package com.miao.im.repository;

import com.miao.im.domain.UserDo;
import com.miao.im.model.AuthResponseModel;
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.Optional;

/**
 * @Auther: miaoguoxin
 * @Date: 2021/4/14 19:42
 * @Description:
 */
public interface IUserRepository {

    void updateUserInfo(UserDo userDo);

    Optional<UserDo> getBySessionId(String sessionId);

    /**
    * reactor模式获取
    * @author miaoguoxin
    * @date 2021/5/20
    */
    Mono<UserDo> reactiveGetBySessionId(String sessionId);

    Optional<UserDo> getByUserId(Long userId);


    Mono<Void> reactiveSaveOnlineUser(AuthResponseModel.AuthResponse userInfo);

    /**
    * 删除在线用户
    * @author miaoguoxin
    * @date 2021/5/18
    */
    void delOnlineUser(String userId, String deviceNumber);

    /**
    * 批量刷新在线用户时间
    * @author miaoguoxin
    * @date 2021/5/18
    */
    void batchRefreshOnlineUser(List<String> keys);

    /**
    * react模式获取在线用户
    * @author miaoguoxin
    * @date 2021/5/20
    */
    Mono<List<AuthResponseModel.AuthResponse>> reactiveGetOnlineUsers(Long userId);

}
